package com.example.learnandroid2;

import androidx.fragment.app.DialogFragment;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

public class UserDefineDialogFragment extends DialogFragment {
    private TextView editTextName1;

    private TextView editTextName2;
    private UserDefineDialogFragment.NotifyDialogListener listener;

    public interface NotifyDialogListener {
        public void onDialogPositiveClicked(String gender);
    }

    public void setListener(UserDefineDialogFragment.NotifyDialogListener listener){
        this.listener = listener;
    }
 /*   @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        LayoutInflater inflater = requireActivity().getLayoutInflater();
        View view = inflater.inflate(R.layout.custom_dialog,null);
        editTextName1 = view.findViewById(R.id.editTextName1);
        editTextName2 = view.findViewById(R.id.editTextName2);
        builder.setTitle("自定义对话框")
                .setPositiveButton("确定", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        listener.onDialogPositiveClicked(editTextName1.getText().toString(),editTextName2);
                    }
                });
        return builder.create();
    }*/
}
